<html>
<body>
<script src="../../../resources/gc.js"></script>
<p>Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13514">bug 13514</a>:
REGRESSION (r20997-21003): Crash in WebCore::Node::Document.</p>
<div id="elem"><p></p></div>

<script>
if (window.testRunner)
  testRunner.dumpAsText();

elem = document.getElementById('elem');

elem.childNodes.length;
elem.childNodes[0].length;
gc();
elem.innerHTML = "";
gc();
elem.childNodes[0];
if (elem.childNodes.length == 0)
  document.write("SUCCESS");
else
  document.write("FAILURE: childNodes.length was cached inappropriately");

</script>
</body>
</html>
